import React from 'react';
/* react-redux有一些方法将redux中的数据渲染到页面
react-redux是用来实现组件和redux之间的通信
 */
import { selectCount,increase } from '../../store/counter';
import {selectCity} from '../../store/City'
import {useSelector,useDispatch} from 'react-redux'
const Index = () => {
    // const count = useSelector(state=>state.counter.count)
    const city = useSelector(selectCity);
    const dispatch = useDispatch()
    const count = useSelector(selectCount);
    return (
        <div>
            <p>{city}</p>
            <p onClick={()=>{
                dispatch(increase())
            }}>{count}</p>
        </div>
    );
}

export default Index;